< previous page page_643 next page >

Page 643
9f31265bb40b592b1929e18a47ab28e5.gif
      intLoop = 1
      Do Until oRS.EOF
         intPercent = CInt((intLoop / intCount) * 100)
         pbrCount.Value = intPercent
         pbrSmooth.Value = intPercent

         Call Delay

         intLoop = intLoop + 1
         oRS.MoveNext
      Loop
      pbrCount.Value = pbrCount.Max
      pbrSmooth.Value = pbrSmooth.Max
   End If
   oRS.Close
   Screen.MousePointer = vbDefault

   MsgBox "Done Counting Employees"
End Sub
This routine first gets the total number of records to loop through. The function RecCountGet() is called to return this number. In this function, a SELECT COUNT(*) FROM tblEmployees is performed to retrieve the total number of records. You could also use the MoveLast method and the RecordCount property after opening the recordset, but SELECT COUNT() is much more efficient; besides, not all OLE DB providers support the RecordCount property, so SELECT COUNT() will always work regardless of which provider youre using.
Each time through the loop, the percentage is calculated by dividing the count by the looping variable and multiplying by 100. This value is then placed in the Value property of each progress bar. In the second progress bar, the Scrolling property is set to 1-SmoothScrolling to get the smooth bar effect.
The Slider Control
The slider control is typically used to allow the user to change a volume setting or increment a value by a small amount (see Figure 31.4).
Examples Filename: Slider.frm

 
< previous page page_643 next page >

If you like this book, buy it!